-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the word order of some of the toast messages #12446
Conversation
Message to maintainers, this PR contains strings changes.
Read more about updating strings on the wiki, |
Actually, we have access to Anki Desktop strings, so we can reuse them directly. I'm on my phone right now, so I can't link the exact implementation on the moment, but if I recall correctly, it is on As the current PR only changes the English translation, I'd approve it, but I would like to see if the approach of reusing the Anki Desktop strings directly wouldn't be better |
Indeed - here's an example usage https://github.com/ankidroid/Anki-Android/pull/11740/files#diff-03de22cd624f1cb4006ae0c6622ec035f598d779dd1dfb64e2207f0a1824933cR42 And I just logged a couple items with regard to backend translation - it's all pretty new for us (#12452 + ankidroid/Anki-Android-Backend#235) |
You can also use CollectionManager.TR(), which doesn't require an open collection or usage of withCol |
Here's how you could do it: diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
index a13e4e352..c122b8bd8 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.kt
@@ -50,6 +50,7 @@ import com.drakeet.drawer.FullDraggableContainer
import com.google.android.material.snackbar.Snackbar
import com.ichi2.anim.ActivityTransitionAnimation
import com.ichi2.anim.ActivityTransitionAnimation.getInverseTransition
+import com.ichi2.anki.CollectionManager.TR
import com.ichi2.anki.CollectionManager.withCol
import com.ichi2.anki.UIUtils.showThemedToast
import com.ichi2.anki.cardviewer.*
@@ -908,6 +909,15 @@ abstract class AbstractFlashcardViewer :
}
}
+ private fun showSnackbarWithUndoButtonText(
+ text: String,
+ duration: Int = Snackbar.LENGTH_SHORT
+ ) {
+ showSnackbarAboveAnswerButtons(text, duration) {
+ setAction(R.string.undo) { undo() }
+ }
+ }
+
private fun getRecommendedEase(easy: Boolean): Int {
return try {
when (answerButtonCount) {
@@ -1648,7 +1658,7 @@ abstract class AbstractFlashcardViewer :
internal fun buryCard(): Boolean {
return dismiss(BuryCard(currentCard!!)) {
- showSnackbarWithUndoButton(R.string.buried_card)
+ showSnackbarWithUndoButtonText(TR.studyingCardsBuried(1))
}
}
|
Thank you all for the information and advice. I'll try :-D |
@BrayanDSO I've tried the approach with My concern is that the approach makes inconsistency about punctuation between the reused messages and the other ones, at least for the moment. In general, the messages of AnkiDroid end without period as follows |
Using Anki translations is something I prefer as it represents a more "shared work" future (between Anki Desktop and AnkiDroid), which may also be read as "less work per contributor" and is thus more sustainable long-term, even if there is punctuation inconsistency. |
Anyone can remove the dot on Poonton (Anki desktop translating platform) later. Sharing translations is the best path for consistency |
I see. Then, I'll continue this approach without so much concern about temporary inconsistency of punctuation. About the approach, I have one question.
For example, if the above replacement is done, should I delete |
If the string isn't somewhere else, you can delete it. Actually, Lint will force will to delete it on this case. |
Thanks. Then, I guess I'd better leave it to Lint Debug to check if the string isn't somewhere else. |
On methods that operate on a note, you can use |
I see. Thanks a lot! |
@dae On Anki Desktop, the actions of Bury and Suspend produce messages whose styles are different from each other as follows. Is it intentional? Action --> Message
|
@dae good question for you just above ☝️ |
Sorry, lost track of this. I think the difference is just because they were added at different times by different people. Suspend card/note came earlier and is only used in the review screen; the bury message was added later, and including the number was likely because it can be used in both the reviewer and browse screen (even though the browse screen doesn't currently provide a bury option, it may in the future). |
@dae @mikehardy thanks. Then, I suppose the following hybrid style might be good. Action --> Message
Same for Suspend
May I continue working in this direction? |
Fine with me |
If we can use the mobile translation with else if we have an AnkiDroid string equivalent to else, create a new one on AnkiDroid |
The AnkiMobile translations are not easily usable. It's possible to migrate individual translations from mobile→desktop, but it's currently it's a bit of a pain to do so I'm afraid. |
Thank you, two. Then, rewriting the following related string on AnkiDroid is currently a handy way, I guess.
|
This comment was marked as resolved.
This comment was marked as resolved.
Reconstruct the strings for the feedback-toast message to Reviewer actions Basically, use strings on Anki Desktop instead of the current ones. Create new ones as needed. For Bury and Suspend, I set the style described in the following comment as a goal: ankidroid#12446 (comment) ------------------------------ - Replace `<string name="buried_card">Card buried</string>` with `<string name="card_buried">Card buried.</string>` - Remove `<string name="buried_note">Note buried</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="deleted_note">Note deleted</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="suspended_card">Card suspended</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Replace `<string name="suspended_note">Note suspended</string>` with the following code: `<plurals name="note_suspended" <item quantity="one">%d card suspended.</item> <item quantity="other">%d cards suspended.</item> </plurals>` ------------------------------
Hello 👋, this PR has been opened for more than 1 month with no activity on it. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I'm going to rebase this one on main
, as it's been stale for a while and some strings need fixing
<string name="card_buried">Card buried.</string> | ||
<plurals name="note_suspended" | ||
<item quantity="one">%d card suspended.</item> | ||
<item quantity="other">%d cards suspended.</item> | ||
</plurals> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up to either lint these or change Anki Desktop to remove the period (depends on dae's thoughts, not worthwhile to ping for something minor until we get our ducks in order)
Change the word order of some of the toast messages "[Subject] (omission of [be Verb]) [Past participle]" word order is used in Anki Desktop and AnkiDroid, but it isn't on some strings of AnkiDroid before change --> after change ------------------------------------------------- "Buried card" --> "Card buried" "Buried note" --> "Note buried" "Deleted note" --> "Note deleted" "Suspended card" --> "Card suspended" "Suspended note" --> "Note suspended" "Created deck" --> "Deck created" "Renamed deck" --> "Deck renamed" "Copied debug information to clipboard" --> "Debug information was copied to clipboard" (no omission of be Verb) -------------------------------------------------
Reconstruct the strings for the feedback-toast message to Reviewer actions Basically, use strings on Anki Desktop instead of the current ones. Create new ones as needed. For Bury and Suspend, I set the style described in the following comment as a goal: ankidroid#12446 (comment) ------------------------------ - Replace `<string name="buried_card">Card buried</string>` with `<string name="card_buried">Card buried.</string>` - Remove `<string name="buried_note">Note buried</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="deleted_note">Note deleted</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="suspended_card">Card suspended</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Replace `<string name="suspended_note">Note suspended</string>` with the following code: `<plurals name="note_suspended" <item quantity="one">%d card suspended.</item> <item quantity="other">%d cards suspended.</item> </plurals>` ------------------------------
146bc18
to
a9ff79e
Compare
- For feedback-toast message to Reviewer actions, reuse strings of Anki Desktop - Use new strings instead of ones of Anki Desktop, as needed
old: about_ankidroid_successfully_copied_debug new: about_ankidroid_successfully_copied_debug_info
a9ff79e
to
cb24a81
Compare
Thank you so much for taking the trouble to do the review and the works! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I'm clearing strings out now then will merge the strings-related stack of PRs queued up |
Reconstruct the strings for the feedback-toast message to Reviewer actions Basically, use strings on Anki Desktop instead of the current ones. Create new ones as needed. For Bury and Suspend, I set the style described in the following comment as a goal: #12446 (comment) ------------------------------ - Replace `<string name="buried_card">Card buried</string>` with `<string name="card_buried">Card buried.</string>` - Remove `<string name="buried_note">Note buried</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="deleted_note">Note deleted</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="suspended_card">Card suspended</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Replace `<string name="suspended_note">Note suspended</string>` with the following code: `<plurals name="note_suspended" <item quantity="one">%d card suspended.</item> <item quantity="other">%d cards suspended.</item> </plurals>` ------------------------------
Hi there @snowtimeglass! This is the OpenCollective Notice for PRs merged from 2023-03-01 through 2023-03-31 If you are interested in compensation for this work, the process with details is here: We only post one comment per person per month to avoid spamming you, regardless of the number of PRs merged, but this note applies to all PRs merged for this month Please note that GSoC contributions are okay for this process. Our philosophy is that our users have donated to AnkiDroid for all contributions. The only PRs that will not go through the OpenCollective process are ones directly related to am accepted GSoC project from a selected participant, since those receive a stipend from GSoC itself. Please understand that our monthly budget is never guaranteed to cover all claims - the cap on payments-per-person may be lower, but we try to make our process as fair and transparent as possible, we just need your understanding. Thanks! |
Reconstruct the strings for the feedback-toast message to Reviewer actions Basically, use strings on Anki Desktop instead of the current ones. Create new ones as needed. For Bury and Suspend, I set the style described in the following comment as a goal: ankidroid#12446 (comment) ------------------------------ - Replace `<string name="buried_card">Card buried</string>` with `<string name="card_buried">Card buried.</string>` - Remove `<string name="buried_note">Note buried</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="deleted_note">Note deleted</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Remove `<string name="suspended_card">Card suspended</string>` (Instead of the string, its counterpart on Anki Desktop will work on the toast.) - Replace `<string name="suspended_note">Note suspended</string>` with the following code: `<plurals name="note_suspended" <item quantity="one">%d card suspended.</item> <item quantity="other">%d cards suspended.</item> </plurals>` ------------------------------
Pull Request template
Purpose / Description
Anki Desktop uses the following word order pattern on some toast messages, for example,
Card suspended.
,but it isn't used on some strings of AnkiDroid, for example,
Suspended card
.It is probably appropriate to use Anki Desktop's word order pattern on AnkiDroid as well.
Fixes
n/a
Approach
Change the strings on 02-strings.xml
How Has This Been Tested?
on my physical device
Learning (optional, can help others)
n/a
Checklist
Please, go through these checks before submitting the PR.